package com.itheima.mq.rabbitmq.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Direct类型的交换机的消费者
 */
@Component
public class RabbitmqDirectExchangeConsumer {

    // 创建日志记录器
    private static final Logger LOGGER = LoggerFactory.getLogger(RabbitmqDirectExchangeConsumer.class) ;

    @RabbitListener(queues = "direct.queue_01")
    public void directExchangeQueue01(String messageBody) {
        LOGGER.info("direct exchange queue 01 message is : {}" , messageBody);
    }

    @RabbitListener(queues = "direct.queue_02")
    public void directExchangeQueue02(String messageBody) {
        LOGGER.info("direct exchange queue 02 message is : {}" , messageBody);
    }
    //监听超时队列的消息
//    @RabbitListener(queues = "direct.queue_03")
//    public void directExchangeQueue03(String messageBody) {
//        LOGGER.info("direct exchange queue 02 message is : {}" , messageBody);
//    }
    //监听死信队列的消息
    @RabbitListener(queues = "dlx.queue")
    public void dlxQueue(String messageBody) {
        LOGGER.info("消费到死信队列的消息 : {}" , messageBody);
    }

}
